home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / GMS / GMSDev / Includes / input / keyboard.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-21  |  4.1 KB  |  128 lines

  1. #ifndef INPUT_KEYBOARD_H
  2. #define INPUT_KEYBOARD_H TRUE
  3.  
  4. /*
  5. **  $VER: keyboard.h V1.0
  6. **
  7. **  (C) Copyright 1996-1998 DreamWorld Productions.
  8. **      All Rights Reserved.
  9. */
  10.  
  11. #ifndef DPKERNEL_H
  12. #include <dpkernel/dpkernel.h>
  13. #endif
  14.  
  15. /****************************************************************************
  16. ** The Keyboard object.
  17. */
  18.  
  19. #define VER_KEYBOARD  1
  20. #define TAGS_KEYBOARD ((ID_SPCTAGS<<16)|ID_KEYBOARD)
  21.  
  22. struct Keyboard {
  23.   struct Head Head;         /* [00] Standard header */
  24.   LONG   Size;              /* [12] Amount of key entries buffer can hold */
  25.   struct KeyEntry *Buffer;  /* [16] Pointer to key buffer array */
  26.   WORD   AmtRead;           /* [20] Amount of keys read from last query */
  27.   WORD   Flags;             /* [22] Special flags */
  28.  
  29.   /*** Private fields below ***/
  30.  
  31.   LONG   prvID;             /* Private ID */
  32. };
  33.  
  34. struct KeyEntry {
  35.   WORD  Qualifier;   /* Shift/Control/CapsLock... */
  36.   UBYTE Value;       /* A/B/C/D... */
  37.   BYTE  Reserved;    /* Reserved for the future */
  38. };
  39.  
  40. /****************************************************************************
  41. ** Key Tags
  42. */
  43.  
  44. #define KEYA_Size  (TLONG|12)
  45. #define KEYA_Flags (TWORD|22)
  46.  
  47. /****************************************************************************
  48. ** Key->Flags
  49. */
  50.  
  51. #define KF_AUTOSHIFT 0x0001  /* Auto-Shift handling */
  52. #define KF_GLOBAL    0x0002  /* Receive all keyboard input */
  53.  
  54. /****************************************************************************
  55. ** KeyEntry Qualifiers.
  56. */
  57.  
  58. #define KQ_LSHIFT   0x0001  /* Left Shift  */
  59. #define KQ_RSHIFT   0x0002  /* Right Shift */
  60. #define KQ_CAPSLOCK 0x0004  /* Caps-Lock   */
  61. #define KQ_CONTROL  0x0008  /* Control Key */
  62. #define KQ_LALT     0x0010  /* Left Alt    */
  63. #define KQ_RALT     0x0020  /* Right Alt   */
  64. #define KQ_LCOMMAND 0x0040  /* Left Amiga  [Command] */
  65. #define KQ_RCOMMAND 0x0080  /* Right Amiga [Command] */
  66. #define KQ_KEYPAD   0x0100  /* This is a keypad key */
  67. #define KQ_REPEAT   0x0200  /* This is a repeated key */
  68. #define KQ_RELEASED 0x0400  /* Key is now being released */
  69. #define KQ_HELD     0x0800  /* Key is being held/pressed */
  70. #define KQ_SHIFT    (KQ_LSHIFT | KQ_RSHIFT)
  71.  
  72. /****************************************************************************
  73. ** Non-ASCII key codes.
  74. */
  75.  
  76. #define K_SCS    0x80   /* Private */
  77. #define K_SLEFT  0x81   /* "Special" key on left */
  78. #define K_HELP   0x82   /* Help */
  79.  
  80. #define K_LSHIFT 0x83   /* Left Shift  */
  81. #define K_RSHIFT 0x84   /* Right Shift */
  82. #define K_CAPS   0x85   /* Caps Lock   */
  83. #define K_CTRL   0x86   /* Control     */
  84. #define K_LALT   0x87   /* Left Alt    */
  85. #define K_RALT   0x88   /* Right Alt   */
  86. #define K_LAMIGA 0x89   /* Left Amiga  */
  87. #define K_RAMIGA 0x8a   /* Right Amiga */
  88.  
  89. #define K_F1     0x8b   /* Function Key 1  */
  90. #define K_F2     0x8c   /* Function Key 2  */
  91. #define K_F3     0x8d   /* Function Key 3  */
  92. #define K_F4     0x8e   /* Function Key 4  */
  93. #define K_F5     0x8f   /* Function Key 5  */
  94. #define K_F6     0x90   /* Function Key 6  */
  95. #define K_F7     0x91   /* Function Key 7  */
  96. #define K_F8     0x92   /* Function Key 8  */
  97. #define K_F9     0x93   /* Function Key 9  */
  98. #define K_F10    0x94   /* Function Key 10 */
  99. #define K_F11    0x95   /* Function Key 11 */
  100. #define K_F12    0x96   /* Function Key 12 */
  101. #define K_F13    0x97   /* Function Key 13 */
  102. #define K_F14    0x98   /* Function Key 14 */
  103. #define K_F15    0x99   /* Function Key 15 */
  104. #define K_F16    0x9a   /* Function Key 16 */
  105. #define K_F17    0x9b   /* Function Key 17 */
  106. #define K_F18    0x9c   /* Function Key 18 */
  107. #define K_F19    0x9d   /* Function Key 19 */
  108. #define K_F20    0x9e   /* Function Key 20 */
  109.  
  110. #define K_UP     0x9f   /* Cursor Up       */
  111. #define K_DOWN   0xa0   /* Cursor Down     */
  112. #define K_RIGHT  0xa1   /* Cursor Right    */
  113. #define K_LEFT   0xa2   /* Cursor Left     */
  114. #define K_SRIGHT 0xa3   /* "Special" key on right */
  115.  
  116. /****************************************************************************
  117. ** Special keys that are recognised under ASCII (here for convenience)
  118. */
  119.  
  120. #define K_BAKSPC 08
  121. #define K_TAB    09
  122. #define K_ENTER  10
  123. #define K_RETURN 10
  124. #define K_ESC    0x1b
  125. #define K_DEL    0x7f
  126.  
  127. #endif /* INPUT_KEYBOARD_H */
  128.